﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace QuanLyThuoc
{
    class ThuocTay:Thuoc
    {
        string thanhPhan;
        public string ThanhPhan
        {
            get { return thanhPhan; }
            set { thanhPhan = value; }
        }
        public ThuocTay() : base()
        { }

        public ThuocTay(string maThuoc, string tenThuoc, decimal giaBan, string congDung, string xuatXu, string cachDung, DateTime hanSuDung, string maNhomThuoc, string thanhPhan, string chongChiDinh, string thanTrong)
            :base(maThuoc, tenThuoc, giaBan, congDung, cachDung, chongChiDinh, hanSuDung, maNhomThuoc)
        {
            this.thanhPhan = thanhPhan;
        }

        public override void NhapThuoc()
        {
            base.NhapThuoc();
            Console.Write("Nhap thanh phan thuoc:");
            thanhPhan = Console.ReadLine();
        }

        public override void XuatThuoc()
        {
            base.XuatThuoc();
            Console.WriteLine("-Thanh phan: " + thanhPhan);
            Console.WriteLine("---------------------------------------");
        }

        //ghi file
        public override void ghiFile()
        {
            FileStream file = new FileStream("DSThuoc.txt", FileMode.Append);
            BinaryWriter bWriter = new BinaryWriter(file);
            bWriter.Write(1);
            bWriter.Close();
            file.Close();
            base.ghiFile();
            FileStream file2 = new FileStream("DSThuoc.txt", FileMode.Append);
            BinaryWriter bWriter2 = new BinaryWriter(file2);
            bWriter2.Write(thanhPhan);
            bWriter2.Close();
            file2.Close();
        }
   }
}
